|
1
|
|
|
import React from "react"; |
|
2
|
|
|
import { FormattedMessage, useIntl } from "react-intl"; |
|
3
|
|
|
import { Application, ApplicationReview } from "../../models/types"; |
|
4
|
|
|
import { Portal } from "../../models/app"; |
|
5
|
|
|
import ApplicationRow from "./ApplicationRow"; |
|
6
|
|
|
import { |
|
7
|
|
|
hrJobPreview, |
|
8
|
|
|
managerJobPreview, |
|
9
|
|
|
hrJobApplications, |
|
10
|
|
|
managerJobApplications, |
|
11
|
|
|
} from "../../helpers/routes"; |
|
12
|
|
|
|
|
13
|
|
|
interface ApplicationReviewWithNavProps { |
|
14
|
|
|
application: Application; |
|
15
|
|
|
handleUpdateApplicationReview: (review: ApplicationReview) => Promise<void>; |
|
16
|
|
|
portal: Portal; |
|
17
|
|
|
} |
|
18
|
|
|
|
|
19
|
|
|
const ApplicationReviewWithNav: React.FC<ApplicationReviewWithNavProps> = ({ |
|
20
|
|
|
application, |
|
21
|
|
|
handleUpdateApplicationReview, |
|
22
|
|
|
portal, |
|
23
|
|
|
}): React.ReactElement => { |
|
24
|
|
|
const intl = useIntl(); |
|
25
|
|
|
|
|
26
|
|
|
const jobUrlMap: { [key in typeof portal]: string } = { |
|
27
|
|
|
hr: hrJobPreview(intl.locale, application.job_poster_id), |
|
28
|
|
|
manager: managerJobPreview(intl.locale, application.job_poster_id), |
|
29
|
|
|
}; |
|
30
|
|
|
|
|
31
|
|
|
const jobApplicationsUrlMap: { [key in typeof portal]: string } = { |
|
32
|
|
|
hr: hrJobApplications(intl.locale, application.job_poster_id), |
|
33
|
|
|
manager: managerJobApplications(intl.locale, application.job_poster_id), |
|
34
|
|
|
}; |
|
35
|
|
|
|
|
36
|
|
|
const jobUrl = jobUrlMap[portal]; |
|
37
|
|
|
const jobApplicationsUrl = jobApplicationsUrlMap[portal]; |
|
38
|
|
|
|
|
39
|
|
|
return ( |
|
40
|
|
|
<div> |
|
41
|
|
|
<div> |
|
42
|
|
|
<div className="manager-application-preview-actions flex-grid"> |
|
43
|
|
|
<div className="box small-1of3"> |
|
44
|
|
|
<a className="button--blue light-bg" href={jobApplicationsUrl}> |
|
45
|
|
|
{`< `} |
|
46
|
|
|
<FormattedMessage |
|
47
|
|
|
id="application.review.backToApplicantList" |
|
48
|
|
|
defaultMessage="Save and Go Back to Applicant List" |
|
49
|
|
|
description="Back Button text" |
|
50
|
|
|
/> |
|
51
|
|
|
</a> |
|
52
|
|
|
</div> |
|
53
|
|
|
<div className="box small-2of3"> |
|
54
|
|
|
<a |
|
55
|
|
|
className="button--blue light-bg" |
|
56
|
|
|
href={jobUrl} |
|
57
|
|
|
style={{ marginRight: ".5rem" }} |
|
58
|
|
|
> |
|
59
|
|
|
<FormattedMessage |
|
60
|
|
|
id="application.review.button.viewJobPoster" |
|
61
|
|
|
defaultMessage="View Job Poster" |
|
62
|
|
|
description="View Job Poster Button text" |
|
63
|
|
|
/> |
|
64
|
|
|
</a> |
|
65
|
|
|
<button |
|
66
|
|
|
className="button--blue light-bg" |
|
67
|
|
|
data-button-type="expand-all" |
|
68
|
|
|
type="button" |
|
69
|
|
|
id="expand-all" |
|
70
|
|
|
> |
|
71
|
|
|
<span className="expand"> |
|
72
|
|
|
{" "} |
|
73
|
|
|
<FormattedMessage |
|
74
|
|
|
id="application.review.expandAllSkills" |
|
75
|
|
|
defaultMessage="Expand All Skills" |
|
76
|
|
|
description="Expand All Skills Button text" |
|
77
|
|
|
/> |
|
78
|
|
|
</span> |
|
79
|
|
|
<span className="collapse"> |
|
80
|
|
|
{" "} |
|
81
|
|
|
<FormattedMessage |
|
82
|
|
|
id="application.review.collapseAllSkills" |
|
83
|
|
|
defaultMessage="Collapse All Skills" |
|
84
|
|
|
description="Collapse All Skills Button text" |
|
85
|
|
|
/> |
|
86
|
|
|
</span> |
|
87
|
|
|
</button> |
|
88
|
|
|
</div> |
|
89
|
|
|
</div> |
|
90
|
|
|
</div> |
|
91
|
|
|
<ApplicationRow |
|
92
|
|
|
application={application} |
|
93
|
|
|
handleUpdateReview={handleUpdateApplicationReview} |
|
94
|
|
|
portal={portal} |
|
95
|
|
|
/> |
|
96
|
|
|
</div> |
|
97
|
|
|
); |
|
98
|
|
|
}; |
|
99
|
|
|
|
|
100
|
|
|
export default ApplicationReviewWithNav; |
|
101
|
|
|
|